var o = require("../../../../common/vendor.js"), e = require("../../../uv-ui-tools/libs/mixin/mpMixin.js"), i = require("../../../uv-ui-tools/libs/mixin/mixin.js"), t = require("./props.js");

require("../../../uv-ui-tools/libs/function/index.js"), require("../../../uv-ui-tools/libs/function/test.js"), 
require("../../../uv-ui-tools/libs/function/digit.js"), require("../../../uv-ui-tools/libs/util/route.js"), 
require("../../../uv-ui-tools/libs/function/debounce.js"), require("../../../uv-ui-tools/libs/function/throttle.js");

var n = {
    name: "uv-search",
    emits: [ "click", "input", "change", "clear", "search", "custom", "focus", "blur", "clickIcon", "update:modelValue" ],
    mixins: [ e.mpMixin, i.mixin, t.props ],
    data: function() {
        return {
            keyword: "",
            showClear: !1,
            show: !1,
            focused: this.focus
        };
    },
    created: function() {
        this.keyword = this.modelValue;
    },
    watch: {
        value: function(o) {
            this.keyword = o;
        },
        modelValue: function(o) {
            this.keyword = o;
        }
    },
    computed: {
        showActionBtn: function() {
            return !this.animation && this.showAction;
        }
    },
    methods: {
        keywordChange: function() {
            this.$emit("input", this.keyword), this.$emit("update:modelValue", this.keyword), 
            this.$emit("change", this.keyword);
        },
        inputChange: function(o) {
            this.keyword = o.detail.value, this.keywordChange();
        },
        clear: function() {
            var o = this;
            this.keyword = "", this.$nextTick(function() {
                o.$emit("clear");
            }), this.keywordChange();
        },
        search: function(e) {
            this.$emit("search", e.detail.value);
            try {
                o.index.hideKeyboard();
            } catch (o) {}
        },
        custom: function() {
            this.$emit("custom", this.keyword);
            try {
                o.index.hideKeyboard();
            } catch (o) {}
        },
        getFocus: function() {
            this.focused = !0, this.animation && this.showAction && (this.show = !0), this.$emit("focus", this.keyword);
        },
        blur: function() {
            var o = this;
            setTimeout(function() {
                o.focused = !1;
            }, 100), this.show = !1, this.$emit("blur", this.keyword);
        },
        clickHandler: function() {
            this.disabled && this.$emit("click");
        },
        clickIcon: function() {
            this.$emit("clickIcon");
        }
    }
};

Array || o.resolveComponent("uv-icon")(), Math;

var r = o._export_sfc(n, [ [ "render", function(e, i, t, n, r, c) {
    return o.e({
        a: e.disabled
    }, (e.disabled, {}), {
        b: o.o(c.clickIcon),
        c: o.p({
            size: e.searchIconSize,
            name: e.searchIcon,
            color: e.searchIconColor ? e.searchIconColor : e.color
        }),
        d: o.o(function() {
            return c.blur && c.blur.apply(c, arguments);
        }),
        e: r.keyword,
        f: o.o(function() {
            return c.search && c.search.apply(c, arguments);
        }),
        g: o.o(function() {
            return c.inputChange && c.inputChange.apply(c, arguments);
        }),
        h: e.disabled,
        i: o.o(function() {
            return c.getFocus && c.getFocus.apply(c, arguments);
        }),
        j: e.focus,
        k: e.maxlength,
        l: e.placeholder,
        m: "color: ".concat(e.placeholderColor),
        n: o.s({
            textAlign: e.inputAlign,
            color: e.color,
            backgroundColor: e.bgColor,
            height: e.$uv.addUnit(e.height)
        }),
        o: o.s(e.inputStyle),
        p: r.keyword && e.clearabled && r.focused
    }, r.keyword && e.clearabled && r.focused ? {
        q: o.p({
            name: "close",
            size: "11",
            color: "#ffffff",
            customStyle: "line-height: 12px"
        }),
        r: o.o(function() {
            return c.clear && c.clear.apply(c, arguments);
        })
    } : {}, {
        s: o.s({
            backgroundColor: e.bgColor,
            borderRadius: "round" == e.shape ? "100px" : "4px",
            borderColor: e.borderColor
        }),
        t: o.s(e.$uv.addStyle(e.boxStyle)),
        v: o.t(e.actionText),
        w: o.s(e.actionStyle),
        x: o.n((c.showActionBtn || r.show) && "uv-search__action--active"),
        y: o.o(function() {
            return c.custom && c.custom.apply(c, arguments);
        }),
        z: o.o(function() {
            return c.clickHandler && c.clickHandler.apply(c, arguments);
        }),
        A: o.s({
            margin: e.margin
        }),
        B: o.s(e.$uv.addStyle(e.customStyle))
    });
} ], [ "__scopeId", "data-v-e3a99171" ] ]);

wx.createComponent(r);